package com.action.main;

import java.sql.SQLException;
import java.util.ArrayList;

import com.db.diary.DiaryManager;
import com.db.diary.MainDiaryVO;
import com.db.mail.MailDAO;
import com.db.mail.MainEmailVO;
import com.db.member.*;
import com.db.notice.*;
import com.db.sancdoc.VDocManager;
import com.db.sancdoc.VTDocManager;
import com.opensymphony.xwork2.ActionContext;

/**
 * @author SIST114
 * 
 */
public class MainMenuAction {
	private int memno;

	private int myundecide;
	private int myend;
	private int mypostpone;
	private int myreturndoc;

	private int undecide;
	private int end;
	private int postpone;
	private int returndoc;
	
	
	private MemInfoVO memVo = new MemInfoVO();
	
	private ArrayList<MainNoticeVO> noticeList = new ArrayList<MainNoticeVO>();

	private ArrayList<MainEmailVO> emailList = new ArrayList<MainEmailVO>();
	
	private ArrayList<MainDiaryVO> diaryList = new ArrayList<MainDiaryVO>();
	
	
	private int unreadEmail;
	
	
	public int getUnreadEmail() {
		return unreadEmail;
	}

	public ArrayList<MainDiaryVO> getDiaryList() {
		return diaryList;
	}

	public int getMemno() {
		return memno;
	}

	public int getMyundecide() {
		return myundecide;
	}

	public int getMyend() {
		return myend;
	}

	public int getMypostpone() {
		return mypostpone;
	}

	public int getMyreturndoc() {
		return myreturndoc;
	}

	public int getUndecide() {
		return undecide;
	}

	public int getEnd() {
		return end;
	}

	public int getPostpone() {
		return postpone;
	}

	public int getReturndoc() {
		return returndoc;
	}

	public MemInfoVO getMemVo() {
		return memVo;
	}

	public void setMemno(int memno) {
		this.memno = memno;
	}
	
	

	public ArrayList<MainEmailVO> getEmailList() {
		return emailList;
	}

	public ArrayList<MainNoticeVO> getNoticeList() {
		return noticeList;
	}

	public String execute() throws Exception{
		System.out.println("MainMenuAction");
		System.out.println("session : " + ActionContext.getContext().getSession().get("memno"));
		
		memno = Integer.parseInt((String) ActionContext.getContext().getSession().get("memno"));//////////////////////////////////////////////////
		
		memVo = MemberManager.meminfoData(memno);
		
		memVo.getName();
		memVo.getDname();
		memVo.getJname();
		

	 	noticeList = (ArrayList<MainNoticeVO>) NoticeDAO.mainBoardList();
		
	 	unreadEmail = MailDAO.unreadMailCount(memno);
	 	
	 	emailList =	(ArrayList<MainEmailVO>) MailDAO.mainEmail(memno);
	 	System.out.println("111111");
	 	diaryList = (ArrayList<MainDiaryVO>) DiaryManager.getMainDiaryList(memno);
	 	System.out.println(diaryList.size());	 
	 	
	 	
	 	
	 	
	 	
	 	
	 	
	 	myundecide = VDocManager.myUndecidedDoc(memno);
		myend = VDocManager.myEndDoc(memno);
		mypostpone = VDocManager.myPostponeDoc(memno);
		myreturndoc = VDocManager.myReturnDoc(memno);

		undecide = VTDocManager.undecidedDoc(memno);
		end = VTDocManager.endDoc(memno);
		postpone = VTDocManager.postponeDoc(memno);
		returndoc = VTDocManager.returnDoc(memno);
	 	
	 	
		return "success";
	}
}
